<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
Object.prototype.instanceof = function(constructor){
    // console.log(this===obj,constructor===Array);
    let L = this;// obj
    const R = constructor;// Array
    while (true){
        if(L === null) return false;
        if(L.__proto__ === R.prototype) return true;
        L=L.__proto__;
    }
}
const Box = function(){

}
const obj = new Box();
console.log(obj instanceof Box,obj.instanceof(Box));// true
console.log(obj instanceof Object,obj.instanceof(Object));// true
console.log(obj instanceof Array,obj.instanceof(Array));// false
console.log([] instanceof Array,[].instanceof(Array));// true
console.log(function(){} instanceof Function,function(){}.instanceof(Function));// true

</script>
</html>